<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>客户流程跟踪</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
	<div class="searchArea">
		<!-- 搜索表单开始 -->
		<form id="searchBar">
			<div class="fieldset1 clearFix">
				<!-- 隐藏当前选中的客户ID信息 -->
				<div class="fieldBox" style="display:none;">
					<div class="field">
						<input name="sCstId" id="sCstId" type="text" class="ui-textbox" value="${sCstId}">
					</div>
				</div>
			</div>
		</form>
		<!-- 搜索表单结束 -->
	</div>
</div>

<!-- 列表显示块 -->
<div id="ligergrid1" class="sq-grid"></div>

<script type="text/javascript">
	var grid = null;
	$(function () {
	    initForm();//初始化表单
	    initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
	});
	
	//初始化表单
	function initForm(){
		$("#searchBar").ligerForm();
	}
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
		var data = form.getData();
		return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#ligergrid1").ligerGrid({
			url:'<%=path%>/customer/cstbscinfo/initFlowList.do',
			method:'get',
			parms:getSearchParams(),
			columns:[
				{ display: '流程名称', name: 'pno', minWidth: 180 , align:'center', enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = '';
						h='<a href="javascript:commShowFlow(';
                        h+="'"+rowdata.pinstId+"',"; //流程实例ID
                        h+="'"+rowdata.audStsCd+"',"; //审核状态
                        h+="'"+rowdata.dataId+"',"; //业务主键ID
                        h+="'"+rowdata.busTyp+"'"; //业务类型
						h+=')">'+value+'</a>';
						return h;
					}},
				{ display: '状态', name: 'audStsCdNm', minwidth: 120, enabledSort:true},
				{ display: '创建人', name: 'crtUsrName', minwidth: 120 , enabledSort:true},
				{ display: '发起时间', name: 'pCrtTm', minwidth: 120, enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate3(rowdata.pCrtTm);
						return h;
					}},
				{ display: '修改时间', name: 'pMdfTm', minwidth: 120, enabledSort:true,
					render: function (rowdata, rowindex, value, column) { 
						var h = renderDate3(rowdata.pMdfTm);
						return h;
					}}
			],
			usePager: false,
			pageSize:10,
			root:'rows',
			record:'total',
			hideLoadButton:false,
			width:'100%',
			height:'100%',
			heightDiff:-2,
			checkbox:false,//列表是否有选择框
			rownumbers:true//列表是否有行号
		});
		grid = liger.get("ligergrid1");
		grid.setHeight(100);
		grid.options.isSingleCheck = true;//列表是否为单选
	}
	
	//显示流程：流程实例ID,状态,业务主键(拖车主表ID)
    function commShowFlow(_pInstId, _audStsCd, _businessKey,busTyp){
    	if(StringUtils.isEmpty(_pInstId)){
    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
    		return;
    	}
    	var _formUrl = "/customer/cstbscinfo/toCstModDetailPage.do?isFlow=1@@isModify=0@@modId=";
    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
    	Add_navTab('tab_cMod_flow_'+_pInstId,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
    }
	
	//格式化时间3：YYYY_MM_DDHHMMSS
	function renderDate3(dateStr1){
		var dateStr2 = "";
		if(null != dateStr1){
			var date = new Date(dateStr1);
			dateStr2 = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
		}
		return dateStr2;
	}
</script>
</body>
</html>